#include "ProcessPool.hpp"
#include "Task.hpp"

//打印提示如何使用该程序的信息
void Usage(std::string proc)
{
    std::cout<< "Usage: " << proc << "process-num" << std::endl;
}

int main(int argc, char *argv[])
{
    if(argc != 2)
    {
        Usage(argv[0]);
        return UsageError;
    }

    int num = std::stoi(argv[1]);
    ProcessPool * pp = new ProcessPool(num, Worker);

    //初始化进程池
    pp->InitProcessPool();
    //派发任务
    pp->DispatchTask();
    //退出进程池
    pp->cleanProcessPool();

    delete pp;

    return 0;
}